using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ASA
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = tbUser.Text.ToString();// "Admin";
            string password = tbPassword.Text.ToString();//"Password";
            try
            {
                AandEDLL.DataAccess.User user = AandEDLL.Accessor.AuthenticateUser(username, password);
                 if (username !=null)

             {
                 textBox1.Text =  "Correct username and password!" ;
                 ResultsForm results = new ResultsForm();
                 results.ShowDialog();
             }
             
            }
            catch
            {
                textBox1.Text = "Sorry, Invalid user name or password!";

            }
           
            

             

    

          // textBox1.Text = user.UserName.ToString();
           
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}